<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加核酸检测信息</title>
  <script th:src="@{/jquery-1.8.3.min.js}"></script>
</head>
<body>
<div class="center">
  <form action="/add" method="post" onsubmit="return fk()">
    <table border="1">
      <tr>
        <td colspan="2">
          <h4>添加核酸检查信息</h4>
        </td>
      </tr>
      <tr>
        <th>被检查人姓名(*)</th>
        <td>
          <input type="text" th:name="assayUser" id="assayUser"/>
        </td>
      </tr>
      <tr>
        <th>被检测人手机号(*)</th>
        <td>
          <input type="text" th:name="phone" id="phone"/>
        </td>
      </tr>
      <tr>
        <th>被检测人身份证号(*)</th>
        <td>
          <input type="text" th:name="cardNum" id="cardNum"/>
        </td>
      </tr>
      <tr>
        <th>检测机构(*)</th>
        <td>
          <select th:name="hospitalId" id="hospitalId">
            <option th:value="0">请选择</option>
            <span th:each="hos : ${list}">
              <option th:value="${hos.id}" th:text="${hos.name}"></option>
            </span>
          </select>
        </td>
      </tr>
      <tr>
        <th>检测日期(*)</th>
        <td>
          <input type="date" th:name="assayTime" id="assayTime"/>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <input type="submit" th:value="添加"/>
          <a th:href="@{/page}">
            <input type="button" th:value="返回"/>
          </a>
        </td>
      </tr>
    </table>
  </form>
</div>
</body>
<script>
  function fk(){
    if(document.getElementById("assayUser").value == ''){
      alert("被检查人姓名不能为空!");
      return false;
    }
    if(document.getElementById("phone").value == ''){
      alert("被检测人手机号不能为空!");
      return false;
    }
    if(document.getElementById("cardNum").value == ''){
      alert("被检测人身份证号不能为空!");
      return false;
    }
    if(document.getElementById("hospitalId").value == 0){
      alert("请选择检测机构!");
      return false;
    }
    if(document.getElementById("assayTime").value == ''){
      alert("请选择检测日期!");
      return false;
    }
    return true
  }
</script>
</html>